package com.project.thisDatabase.base.service;

import com.project.thisDatabase.base.model.DBEntity;
import com.project.thisDatabase.base.model.BaseUpdateEntity;
import com.project.thisDatabase.base.model.EntityBase;
import com.project.thisDatabase.base.model.EntityPageBase;
import com.project.thisDatabase.base.model.data.Condition;
import com.project.thisDatabase.base.model.entities.IntResultEntity;
import com.project.thisDatabase.base.model.entities.PageEntity;

import java.util.List;

public interface ServiceInterfaceBase<T extends EntityBase> {

    List<T> search(T entity);
    List<T> searchPage(EntityPageBase<T> entity);
    int update(T entity);
    int updateAll(T entity);
    int insert(T entity);
    int updateSearchList(BaseUpdateEntity<T> entity);
    int deleteList(BaseUpdateEntity<T> entity);
    int insertList(List<T> entity);
    int updateList(List<T> entity);
    IntResultEntity count(T entity);
    int insertOrUpdate(T entity);

    List<T> searchAut(T entity);
    List<T> searchPageAut(EntityPageBase<T> entity);
    int updateAut(T entity);
    int insertAut(T entity);
    int insertListAut(List<T> entity);
    int updateListAut(List<T> entity);
    int updateSearchListAut(BaseUpdateEntity<T> entity);
    int deleteListAut(BaseUpdateEntity<T> entity);
    IntResultEntity countAut(T entity);

    int physicalDeleteAut(T entity);

    <U> List<T> search(Condition<U> item) throws Exception;
    <U> List<T> search(Condition<U> item, PageEntity page) throws Exception;
    <U> List<T> search(String[] cols, Condition<U> item, PageEntity page) throws Exception;
    <U> int update(T change, Condition<U> item) throws Exception;
    int change(T change) throws Exception;
    <U> int delete(Condition<U> item) throws Exception;

    T setKeys(T obj);
}
